<template>
  <a-modal title="录取审核界面" :visible="AuditHandleVisible" @ok="handleSave" @cancel="handleClose">
    <a-form>
      <div>
        <a-form-item label="录取状态">
          <a-select :allowClear="true" showSearch v-model="postParams.lqzt">
            <a-select-option v-for="i in selectMenu.tjztlb" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
        </a-form-item>
      </div>
      <div>
        <a-form-item label="说明">
          <a-textarea placeholder="请输入..." v-model="postParams.note" :rows="4" />
        </a-form-item>
      </div>
    </a-form>
  </a-modal>
</template>

<script>
  // import moment from 'moment'

  export default {
    props: {
      AuditHandleVisible: {
        default: false
      },
      info: {
        default: () => ({})
      }
    },
    data() {
      return {
        postParams: {
          lqzt: '',
          note: '',
          id:''
        },
        selectMenu: {
          tjztlb: []
        },
        checkType: ''
      }
    },
    watch: {
      info(val) {

        this.postParams.id = this.info.id
        this.chekType = this.info.chekType
        console.log(this.postParams)
        this.$api.base.dictionaryData('TYPE0133').then(res => {
          this.selectMenu.tjztlb = res.data
          // this.postParams.shzt = res.data[1].value;
          this.postParams.lqzt  = res.data[0].code
        })
      }
    },
    created() {
      // 获取调剂状态

    },
    methods: {
      initValue(){
        this.postParams = {
          lqzt:'',
          note:'',
          id:''
        }
      },
      handleSave() {
        var params = {}
        if (this.chekType == 'single') {
          params = {
            ksxxId:this.postParams.id,
            lqzt:this.postParams.lqzt,
            note:this.postParams.note
          }
          this.$api.recruitstat.admissionAuditUpdate(params).then(res => {
            this.$emit('success',params)
            this.initValue()
          })

        } else {
          params = {
            ksxxIds:this.postParams.id,
            lqzt:this.postParams.lqzt,
            note:this.postParams.note
          }
          this.$api.recruitstat.admissionAuditMulCheck(params).then(res => {
            this.$emit('success', params)
            this.initValue()
          })
        }
      },
      handleClose() {
        this.$emit('quit')
      }
    }
  }
</script>
